<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
?>

<?php
$user 	=& JFactory::getUser();
if ( $user->get('guest')) {
?>
<div>
  <div class="bg_pup5">
    <div class="boder_bt p10t p5b p14l p12r ">
      <p class="text_tt3 float_left p5t p10l">Fakta-boks </p>
      <!--<p class="text_tt2 float_right"><a href="#"><img src="templates/xescort/images/bt_close.png"></a></p>-->
      <br class="cb">
    </div>
    <div class=" p45l p17t">
      Please login!
    </div>
  </div>
</div>
<?php	
}else{
	
?>
<div>
  <div class="bg_pup5">
    <div class="boder_bt p10t p5b p14l p12r ">
      <p class="text_tt3 float_left p5t p10l">Fakta-boks </p>
      <!--<p class="text_tt2 float_right"><a href="#"><img src="templates/xescort/images/bt_close.png"></a></p>-->
      <br class="cb">
    </div>
    <div class=" p45l p17t">
    <form action="<?php echo JRoute::_('index.php'); ?>" class="form-validate" method="post" name="registerForm" id="registerForm">
      <label>Navn:</label>
      <input type="text" name="name" id="name" class="txt_mail w296" value="<?php echo $user->get('name') ?>">
      <input type="hidden" name="username" id="username" value="<?php echo $user->get('username') ?>"/>
      <br>
      <label>Køn:</label>
      <select name="gender" id="gender" class="txt_list w304">
         <option value="">Vælg</option>
          <option value="0" <?php if ($user->get('gender')==0){ ?> selected="selected" <?php } ?>>Mandlige</option>
          <option value="1" <?php if ($user->get('gender')==1){ ?> selected="selected" <?php } ?>>Kvindelige</option>
      </select>
      <br>
      <label>Højde:</label>
      <input type="text" name="height"  id="height" class="txt_mail w296" value="<?php echo $user->get('height') ?>">
      <br>
      <label>Vægt:</label>
      <input type="text" name="weight" id="weight" class="txt_mail w296" value="<?php echo $user->get('weight') ?>">
      <br>
      <label>Bryst størrelse:</label>
      <input type="text" name="breast" id="breast" class="txt_mail w296" value="<?php echo $user->get('breast') ?>">
      <br>
      <label>Øje-farve:</label>
      <input type="text" name="eyecolor" id="eyecolor" class="txt_mail w296" value="<?php echo $user->get('eyecolor') ?>">
      <br>
      <label>Hår-farve:</label>
      <input type="text" name="haircolor" id="haircolor" class="txt_mail w296" value="<?php echo $user->get('haircolor') ?>">
      <br>
      <label>Type:</label>
      <input type="text" name="bodyform" id="bodyform" class="txt_mail w296" value="<?php echo $user->get('bodyform') ?>">
      <br>
      <label>Telefon:</label>
      <input type="text" name="telephone" id="telephone" class="txt_mail w296" value="<?php echo $user->get('telephone') ?>">
      <br>
      <label>Website link:</label>
      <input type="text" name="website" id="website" class="txt_mail w296" value="<?php echo $user->get('website') ?>">
      <br>
      <label>Email:</label>
      <input type="text" name="email" id="email" class="txt_mail w296" value="<?php echo $user->get('email') ?>">
      <br>
      <label>&nbsp;</label>
      <a href="javascript:void(0);" onclick="click_send();"><img src="templates/xescort/images/bt_gem.png" name=""></a>
      <input type="submit" name="send" id="send" value="Send" style="display: none;" />
      <input type="hidden" name="task" value="save" />
      <input type="hidden" name="option" value="com_user" />
      <input type="hidden" name="id" value="<?php echo $user->get('id') ?>" />
      <input type="hidden" name="gid" value="<?php echo $user->get('gid') ?>" />
      <?php echo JHTML::_( 'form.token' ); ?>
      </form>
    </div>
  </div>
</div>
<script language="javascript">
jQuery(document).ready(function($) {	
	
	jQuery("#registerForm").validate({
		errorPlacement: function(error, element) {			
		},
		invalidHandler: function(form, validator) {
		  var errors = validator.numberOfInvalids();
		  if (errors) {
			jQuery('#alert').html(validator['errorList'][0]['message']);
			jQuery('#backoverlay').show();
			jQuery('#show_popup').show();
			jQuery('#f_focus').html(validator['errorList'][0]['element'].name);
			validator['errorList'][0]['element'].focus();
		  } else {
		  }
		},
		rules: {
			name : "required",
			gender : "required",
			telephone : "required",
			email: {
				required: true,
				email: true
			}
		},
		messages: {
			name: "Navn skal udfyldes!",
			gender: "Køn skal udfyldes!",
			telephone: "Telefonnr skal udfyldes!",
			email: "Email skal udfyldes!"
		}
	
	});
	
	click_send=function(){
		fillusername();	
		document.getElementById('send').click();
	}
	
	fillusername=function(){
		var value = $("#name").val();
		$("#registerForm #username").val(value);
	}
	
	close_popup=function(){		
		var fel=jQuery('#f_focus').html();
		jQuery('#backoverlay').hide();
		jQuery('#show_popup').hide();
		jQuery('#' + fel ).focus();
	};
});
</script>
<?php
}
?>
